<?php
/*
* Author: Nguyen Hai Nam
* Plugin: MenuTopPlugin
* Desc	: Introduce pick.vn and sidle pic
* Date	: 12/12/2011
*/
class MenuTopPlugin extends Pick_Core_Plugin{
	
	function MenuTopPlugin(){
		parent::Pick_Core_Plugin();
		$this->namePlugin = "menutop";
		$this->descriptionPlugin = "This is menu top of all pages";
	}
	public function getContent(){

		// r-d
		$newscategory = new Pick_Dao_NewsCategory();
		$news = new Pick_Dao_News();
		$objCategoryRD = $newscategory->getObjectFromSlug('r-d');
		$objRDDefault = $news->getObjectFirstOneFromCId($objCategoryRD->getField('id'));
		$this->template->assign('objRDDefault', $objRDDefault);
		unset($objCategoryRD);
		unset($objRDDefault);

		// environment
		$objCategoryEnvironment = $newscategory->getObjectFromSlug('environment');
		$objEnvironmentDefault = $news->getObjectFirstOneFromCId($objCategoryEnvironment->getField('id'));
		$this->template->assign('objEnvironmentDefault', $objEnvironmentDefault);
		unset($objCategoryEnvironment);
		unset($objEnvironmentDefault);

		// careers
		$objCategoryCareers = $newscategory->getObjectFromSlug('careers');
		$objCareersDefault = $news->getObjectFirstOneFromCId($objCategoryCareers->getField('id'));
		$this->template->assign('objCareersDefault', $objCareersDefault);
		unset($objCategoryCareers);
		unset($objCareersDefault);

		// news-media
		$objCategoryNewsMedia = $newscategory->getObjectFromSlug('news-media');
		$objNewsMediaDefault = $newscategory->getObjectFirstOneFromCId($objCategoryNewsMedia->getField('id'),array('position'=>'DESC'));
		$this->template->assign('objNewsMediaDefault', $objNewsMediaDefault);
		unset($objCategoryNewsMedia);
		unset($objNewsMediaDefault);

	}
}